//
//  ScrollViewLayer.h
//  CanYouDoIt
//
//  Created by hoangtx on 7/7/13.
//
//

#ifndef CanYouDoIt_ScrollViewLayer_h
#define CanYouDoIt_ScrollViewLayer_h

#include "SwipeGestureLayer.h"
#include "MyPageButton.h"
using namespace cocos2d;

class ScrollViewLayer : public SwipeGestureLayer{
protected:
    CCArray* pageArray;
    int currentPage;
    bool isDoingAnimation;
    double distancePerPage;
    int numberOfPages;
public:
    CCRect getScrollingArea();
    double getDistancePerPage();
    void goToNext();
    void goToPrev();
    void goToPage(int page);
    void movePagesBy(CCPoint point);
    virtual void didBeginMovingPages();
    virtual void didFinishMovingPages(CCObject* sender);
    virtual void onTapAtPage(CCObject* sender);
    MyPageButton* getPageAt(int pageIndex);
    virtual bool init();
    static ScrollViewLayer* create(int numOfPages);
    virtual void ccTouchesBegan(CCSet* touches, CCEvent* pEvent);
    virtual void ccTouchesMoved(CCSet* touches, CCEvent* pEvent);
    virtual void ccTouchesEnded(CCSet* touches, CCEvent* pEvent);
    void setUpPages(int numOfPages);
    CREATE_FUNC(ScrollViewLayer);
};

#endif
